<?php
/*------------------------------------------------------------------------------
* Project     : GStart
*------------------------------------------------------------------------------
* Created     : [26/02/09]
* Author       : [G.AZEMA]
*
* Changes     : 
*
* Description : Gestion des utilisateurs
*------------------------------------------------------------------------------*/
require_once('DataBase.php');
class Users
{
	var $bd;
	
	/*Constructeur*/
	function Users(){
		$this->bd = new DataBase();
	}
	
	//Identification d'un utilisateur
	function ident($id, $pass){
		$this->bd->connect();
		$sql = 'SELECT * '
        . ' FROM `start_users` '
        . ' WHERE `idUser` = \''.$id.'\' AND `pwd` = \''.$pass.'\'';
		$result = mysql_query($sql);
		$nb = mysql_numrows($result);
		if($nb == 0){
			return false;
		}else{
			return true;
		}
	}
	
	//Liste des favoris icones d'un utilisateur
	function getIconsFavoris($idUser){
		$res = array();
		$this->bd->connect();
		$sql = 'SELECT * FROM `favoris` WHERE `idUser` = \''.$idUser.'\' AND (`label` = \'lb_webmail\' OR `label` = \'lb_bank\' OR `label` = \'lb_meteo\' OR `label` = \'lb_tv\')';
		$result = mysql_query($sql) or die(mysql_error());
		while($line = mysql_fetch_array($result)) {
			$res[$line['label']] = $line['adresse'];
		}
		return $res;
	}
	
}
?>